package com.yhg.qxmall.search.front;

import com.yhg.common.utils.R;
import com.yhg.qxmall.search.service.MallSearchService;
import com.yhg.qxmall.search.vo.SearchParam;
import com.yhg.qxmall.search.vo.SearchResult;
import com.yhg.qxmall.search.vo.temp.MQSearchParam;
import com.yhg.qxmall.search.vo.temp.MQSearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 凌月青缃
 * @date 2020/12/18
 */
@RestController
@RequestMapping("/front/search")
public class FrontSearchContoller {
    @Autowired
    MallSearchService mallSearchService;

    @GetMapping("/list.html")
//    public R listPage(@RequestBody(required = false)SearchParam param){
    public R listPage(SearchParam param){
            SearchResult result = mallSearchService.search(param);
        return R.ok().put("data",result);
    }


/*************                ===========       单纯使用mysql完成检索模块        ============             ***************/
    /**
     * Mysql 方式实现接口
     */
    @GetMapping("/searchList")
    public R MysqllistPage(MQSearchParam param){
        MQSearchResult result = mallSearchService.searchFromMysql(param);
        return R.ok().put("data",result);
    }
/*************                ===========       单纯使用mysql完成检索模块        ============             ***************/



}
